import React, { Component, PropTypes } from 'react';
import { connect } from 'dva';
import { Link } from 'dva/router';
import { WingBlank, WhiteSpace, List, Badge } from 'antd-mobile';
import styles from './styles.less';
import moment from 'moment';
import 'moment/locale/zh-cn';

const MessageListPage = ({ dispatch, location, messages, ...rest }) => {
  return(
  <WingBlank size="md">
    <WhiteSpace />
    <List className="doctor-noti">
      {messages.map((message, i) => {
        return (
          <Link key={i} to={{
            pathname: `${location.pathname}/${message.doctorId}`,
            state: {
              title: message.name,
              doctorId: message.doctorId,
              doctor: message.name,
            },
          }}>
            <List.Item
              align="top"
              extra={<div>{message.createTime}</div>}>
              <Badge text={message.badge} />
              {message.name}
              <List.Item.Brief>
                {message.messages}
              </List.Item.Brief>
            </List.Item>
          </Link>
        );
      })}
    </List>
  </WingBlank>
)};

export default MessageListPage;
